import java.util.List;
import java.util.Vector;

import javax.swing.table.DefaultTableModel;

public class TableModel extends DefaultTableModel {
	Vector rows = new Vector();
	Vector columns = new Vector();

	public TableModel() {
		super();
		setDataVector(rows, columns);
	}

	public void setColumns(String[] colName) {
		for (int i = 0; i < colName.length; i++)
			columns.addElement((String) colName[i]);
	}

	public void setColumnsV(Vector cols) {
		for (Object col : cols) {
			columns.add(col);
		}
	}
	
	public void setColumns(List<String> cols) {
		for (Object col : cols) {
			columns.add(col);
		}
	}

	public void addRow() {
		Vector r = new Vector();
		r = createBlankRow();
		rows.add(r);
	}
	
	public void addRowV(Vector r) {
		rows.add(r);
	}
	
	public void addRow(List<String> row) {
		Vector r = new Vector();
		for (int i = 0; i < row.size(); i++) 
			r.add(row.get(i));	
		rows.add(r);
	}
	

	public Vector createBlankRow() {
		Vector t = new Vector();
		for (int i = 0; i < columns.size(); i++) {
			t.add("");
		}
		return t;
	}





}
